import scrapy
from itcastSpider.items import ItcastspiderItem

class ItcastSpider(scrapy.Spider):
    name = 'itcast'
    allowed_domains = ['itcast.cn']
    start_urls = ['http://www.itcast.cn/channel/teacher.shtml']

    def parse(self, response):
        li_list = response.xpath("//div[@class='tea_con']//li")
        for li in li_list:
            # print(len(li_list))
            item = ItcastspiderItem()
            item["name"] = li.xpath(".//h3/text()").extract_first()
            item["position"] = li.xpath(".//h4/text()").extract_first()
            item["desc"] = li.xpath(".//p/text()").extract_first()
            print(item)
            # yield